package com.bw.doctor.controller;/**
 * @Author：尚志豪
 * @Package：com.bw.doctor.controller
 * @Project：doudi-group2-shixun-02
 * @name：PharmacyController
 * @Date：2025/2/25 11:46
 */

import com.bw.common.core.domain.R;
import com.bw.common.core.web.controller.BaseController;
import com.bw.doctor.domain.Prescription;
import com.bw.doctor.service.PharmacyService;
import com.bw.domain.Restoratives;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: doudi-group2-shixun-02
 * @description: 我的药房
 * @author: CuiFu Bo
 * @create: 2025-02-25 11:46
 **/
@RestController
@RequestMapping("/pharmacy")
public class PharmacyController extends BaseController
{
    @Autowired
    private PharmacyService pharmacyService;

    /**
     * B端 我的药房 常用药列表
     */
    @PostMapping("/listOfCommonDrugs/{doctorId}")
    public List<com.bw.doctor.domain.Restoratives> listOfCommonDrugs(@PathVariable Long doctorId)
    {
        List<com.bw.doctor.domain.Restoratives> list = pharmacyService.listOfCommonDrugs(doctorId);
        return list;
    }

    /**
     * B端 我的药房 常用药删除
     */
    @PostMapping("/deletionOfCommonDrugs")
    public R deletionOfCommonDrugs(@RequestParam Long restorativesId, @RequestParam Long doctorId)
    {
         pharmacyService.deletionOfCommonDrugs(restorativesId,doctorId);
         return R.ok("常用药删除成功");
    }
    /**
     * B端 我的药房 常用药详情
     */
    @PostMapping("/detailsOfCommonDrugs")
    public R<com.bw.domain.Restoratives> detailsOfCommonDrugs( @RequestParam Long restorativesId)
    {
        com.bw.domain.Restoratives restoratives = pharmacyService.detailsOfCommonDrugs(restorativesId);
        return R.ok(restoratives);
    }
    /**
     * B端 我的药房 常用药添加
     */
    @PostMapping("/additionOfCommonDrugs")
    public R additionOfCommonDrugs( @RequestParam Long restorativesId, @RequestParam Long doctorId)
    {
        pharmacyService.additionOfCommonDrugs(restorativesId, doctorId);
        return R.ok("常用药添加成功");
    }




    /**
     * B端 我的药房 常用处方添加
     */
    @PostMapping("/commonlyPrescribedAddition")
    public R commonlyPrescribedAddition ( @RequestParam Prescription prescription, @RequestParam List<Long> ids,@RequestParam Long doctorId )
    {
        pharmacyService.commonlyPrescribedAddition(prescription,ids,doctorId);
        return R.ok("常用处方添加成功");
    }
    /**
     * B端 我的药房 常用处方删除
     */
    @PostMapping("/commonPrescriptionDeletion")
    public R commonPrescriptionDeletion( @RequestParam Long prescriptionId)
    {
        pharmacyService.commonPrescriptionDeletion(prescriptionId);
        return R.ok("常用处方删除成功");
    }
    /**
     * B端 我的药房 常用处方病症详情
     */
    @PostMapping("/commonPrescriptionDetails")
    public R<com.bw.domain.Prescription> commonPrescriptionDetails( @RequestParam Long prescriptionId)
    {
        com.bw.domain.Prescription prescription = pharmacyService.commonPrescriptionDetails(prescriptionId);
       return R.ok(prescription);
    }
    /**
     * B端 我的药房 常用处方药物详情
     */
    @PostMapping("/commonPrescriptionDetailsMedicine")
    public R<List<Restoratives>> commonPrescriptionDetailsMedicine(@RequestParam Long prescriptionId)
    {
        List<com.bw.domain.Restoratives> restorativesList = pharmacyService.commonPrescriptionDetailsMedicine(prescriptionId);
        System.out.println("restorativesList" + restorativesList);
       return R.ok(restorativesList);
    }
    /**
     * B端 我的药房 常用处方列表
     */
    @PostMapping("/listOfCommonPrescriptions/{doctorId}")
    public List<com.bw.domain.Prescription> listOfCommonPrescriptions(@PathVariable Long doctorId)
    {
        List<com.bw.domain.Prescription> list = pharmacyService.listOfCommonPrescriptions(doctorId);
        return list;
    }








}
